package cn.itsource.ymcc.feignclient.fallback;

import cn.itsource.ymcc.domain.Login;
import cn.itsource.ymcc.feignclient.UaaFeignClient;
import cn.itsource.ymcc.result.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UaaFeignClientFallbackFactory implements FallbackFactory<UaaFeignClient> {
    @Override
    public UaaFeignClient create(Throwable throwable) {
        return new UaaFeignClient() {
            @Override
            public JsonResult saveOrUpdate(Login login) {
                return JsonResult.error(throwable.getMessage());
            }
        };
    }
}
